package com.mb.search.controller;

import com.mb.common.vo.EasyUIResult;
import com.mb.search.service.SearchSercvice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/search/manage/")
public class SearchController {

    @Autowired
    private SearchSercvice searchSercvice;

    @RequestMapping("query")
    public List<String> doQuery(String query, Integer page, Integer rows) {
        if (page == null) {
            throw new RuntimeException("page不能为空");
        }
        if (rows == null) {
            throw new RuntimeException("rows不能为空");
        }

        return searchSercvice.search(query,page,rows);
    }

    @RequestMapping("find")
    public List<String> doFind(String query){
        return searchSercvice.find(query);
    }
}
